package top.kaoshanji.p1ch11a;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 代码清单-p1ch11a-376页a：直接到主页-转发到JSP页面去
 * URL访问地址：/homePageForward
 * @author kaoshanji
 * ^_^
 * create time 2025/4/5 15:53
 */
public class HomePageForward extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // 转发到JSP页面去
        RequestDispatcher dispatcher = req.getRequestDispatcher("/index.jsp");
        dispatcher.forward(req, resp);
    }

}
